package com.go.core.repo;

import com.go.core.bean.DdsScore;
import com.go.core.bean.RunningScore;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface DdsScoreRepo extends JpaRepository<DdsScore, Integer> {

    @Transactional
    @Modifying
    @Query("update DdsScore sb set sb.score = ?2 where sb.uuid = ?1")
    int updateScoreByUUID(String uuid, int socre);

    @Query(nativeQuery = true, value = "select * from small_dds_score")
    List<DdsScore> getScoreBorad();

    @Query(value = "select sb from DdsScore sb where sb.uuid = ?1")
    DdsScore findByUUID(String uuid);

}
